#pragma once
#include "HashTable.h"
namespace hzp {
	template<class K, class hash = Hash<K>>
	class Unordered_Set {
		struct SetKeyOfT {
			const K& operator()(const K& key) {
				return key;
			}
		};
	public:
		typedef typename LinkHash::HashTable<K, K, SetKeyOfT, hash>::iterator iterator;
		iterator begin() {
			return _ht.begin();
		}
		iterator end() {
			return _ht.end();
		}
		pair<iterator, bool> Insert(const K& key) {
			return _ht.Insert(key);
		}
	private:
		LinkHash::HashTable<K, K, SetKeyOfT, hash> _ht;
	};
	void test_Unordered_Set() {
		Unordered_Set<int> us;
		us.Insert(4);
		us.Insert(14);
		us.Insert(34);
		us.Insert(7);
		us.Insert(24);
		us.Insert(17);

		Unordered_Set<int>::iterator it = us.begin();
		while (it != us.end()) {
			cout << *it << " ";
			++it;
		}

		Unordered_Set<string> uss;
		uss.Insert("sort");
		uss.Insert("hash");
	}
}